(function($){
	$(document).ready(function(){
		if($('.course-submit').length > 0) {
			var wm_form = '';
			var wm_row = '';
			var nid = '';
			var order = '';
			var status = '';
			var wm_url = '';
			$('.course-submit').click(function(event){
				wm_form = $(this).closest('form');
				wm_row = $(this).closest('tr');

				//course-user-display
				nid = wm_form.find('input[name="d2tweb_course_nid"]').attr('value');
				order = wm_form.find('input[name="d2tweb_course_order"]').attr('value');
				status = wm_form.find('[name="d2tweb_course_status"]').val();
				wm_url = Drupal.settings.basePath+'?q=admin/course/status/'+nid+'/'+order+'/'+status;
				$.ajax({
					url: wm_url,
					success: function(data){
						wm_row.find('.course-status-display').html(status);
						wm_row.find('.course-user-display').html(data);
					}
				});
				event.preventDefault();
			});
		}
	})
})(jQuery)
